#ifndef FSXDATADEFINITIONSHELPER_H
#define FSXDATADEFINITIONSHELPER_H

// windows.h is required for SimConnect.h
#include <windows.h>
#include <QString>
#include <QStringList>
#include <QMetaEnum>
#include "fsxdatadefinitions.h"
#include "./FSXAcceleration/SimConnect.h"

namespace FsxSimConnect {

//! Helper to init the data definitions
/*! \author KWB */
class FSXDataDefinitionsHelper
{
private:
    //! Init the data definitions.
    /*! \param hSimConnect handle
        \return failures */
    static int initFSXAircraftMinimal(const HANDLE hSimConnect);
    //! Init the data definitions.
    /*! \param hSimConnect handle
        \return failures */
    static int initFSXAircraftStringAndMiscData(const HANDLE hSimConnect);
    //! Init the data definitions.
    /*! \param hSimConnect handle
        \return failures */
    static int initFSXAircraftPositionAndSpeedData(const HANDLE hSimConnect);
    //! Init the data definitions.
    /*! \param hSimConnect handle
        \return failures */
    static int initFSXAircraftInstrumentationData(const HANDLE hSimConnect);
    //! Init the data definitions.
    /*! \param hSimConnect handle
        \return failures */
    static int initFSXAircraftAvionicsData(const HANDLE hSimConnect);
    static int _requestAircraftPositionAndSpeedData; /*!< request data counter */
    static int _requestAircraftStringAndMiscData; /*!< request data counter */
    static int _requestAircraftInstrumentationData; /*!< request data counter */
    static int _requestAircraftAvionicsData; /*!< request data counter */

public:
    //! For FSX, enum of data definitions.
    enum DataDefinitions {
        DataDefinitionAircraftMinimal, /*!< minimalisitc data request */
        DataDefinitionAircraftStringAndMiscData, /*!< string / misc data request */
        DataDefinitionAircraftPositionAndSpeedData, /*!< psoition/speed data request */
        DataDefinitionAircraftInstrumentationData, /*!< instrumentation data request */
        DataDefinitionAircraftAvionicsData, /*!< avionics data request */
        DataDefinitionEndMarker /*!< marker, new requests can start here */
    };
    //! For FSX, enum of requests.
    enum Requests {
        RequestAircraftMinimal = 1000 , /*!< minimal (very few) aircraft data */
        RequestAircraftStringAndMiscData = 2000, /*!< string aircraft data */
        RequestAircraftPositionAndSpeedData = 3000, /*!< position / speed aircraft data */
        RequestAircraftInstrumentationData = 4000, /*!< instrumentation aircraft data */
        RequestAircraftAvionicsData = 5000, /*!< avionics aircraft data */
        RequestDefinitionEndMarker = 6000 /*!< new requests will start here */
    };
    //! Init helper
    /*! \param hSimConnect */
    static int init(const HANDLE hSimConnect);
    //! Get a unique request id within a given range.
    /*! \param requestType type of request
        \return SIMCONNECT_DATA_REQUEST_ID id */
    static SIMCONNECT_DATA_REQUEST_ID getRequestId(Requests requestType);
    //! Request type for unique request.
    /*! \param individualId SIMCONNECT_DATA_REQUEST_ID
        \return Requests type of request */
    static Requests getBaseRequestId(SIMCONNECT_DATA_REQUEST_ID individualId);

private:
    //! Ranges for ids used with FSX, revolving.
    static const int RequestAircraftStringAndMiscDataRange = (int)RequestAircraftPositionAndSpeedData - (int)RequestAircraftStringAndMiscData -1;
    //! Ranges for ids used with FSX, revolving.
    static const int RequestAircraftPositionAndSpeedDataRange = (int)RequestAircraftInstrumentationData -(int)RequestAircraftPositionAndSpeedData -1;
    //! Ranges for ids used with FSX, revolving.
    static const int RequestAircraftInstrumentationDataRange = (int)RequestAircraftAvionicsData -(int)RequestAircraftInstrumentationData -1;
    //! Ranges for ids used with FSX, revolving.
    static const int RequestAircraftAvionicsDataRange = (int)RequestDefinitionEndMarker -(int)RequestAircraftAvionicsData -1;
};
} // namespace

#endif // FSXDATADEFINITIONSHELPER_H
